//
//  CashViewController.m
//  Article
//
//  Created by Haricot_cpc17 on 16/4/21.
//  Copyright © 2016年 mac. All rights reserved.
//
//提现
#import "CashViewController.h"
#import "WeChatViewController.h"
@interface CashViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong)UITableView *tableView;


@end

@implementation CashViewController

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.tabBarController.tabBar.hidden = YES;
       
    [self createUI];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"arrow"] style:UIBarButtonItemStylePlain target:self action:@selector(back)];
    
    self.view.backgroundColor = UIColorFromRGB(MYBlue);
    
    self.navigationItem.title = @"申请提现";
    // Do any additional setup after loading the view.
}
-(void)back{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)createUI{
    _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT) style:UITableViewStylePlain];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"CashID"];
    [self.view addSubview:_tableView];
    _tableView.scrollEnabled = NO;
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(20, HEIGHT - 400 *MYHEIGHT, WIDTH - 40, 40)];
    button.backgroundColor = UIColorFromRGB(MYBlue);
    [button setTitle:@"提现到微信" forState:UIControlStateNormal];
    button.layer.cornerRadius = 5;
    [_tableView addSubview:button];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CashID" forIndexPath:indexPath];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    if (indexPath.row == 0) {
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.textLabel.text = @"提现到微信";
        cell.textLabel.font = [UIFont fontWithName:@"Heiti SC" size:16 *MYWIDTH];
        cell.accessoryType = UITableViewCellAccessoryNone;
        
        UIButton *WeChatBtn = [[UIButton alloc]initWithFrame:CGRectMake(150 *MYWIDTH, 10, 100 *MYWIDTH, 60)];
        [WeChatBtn setTitle:@"绑定微信号" forState:UIControlStateNormal];
        WeChatBtn.titleLabel.font = [UIFont fontWithName:@"Heiti SC" size:13 *MYWIDTH];
        [WeChatBtn setTitleColor:UIColorFromRGB(MYBlue) forState:UIControlStateNormal];
        [WeChatBtn addTarget:self action:@selector(WeChatClick:) forControlEvents:UIControlEventTouchUpInside];
        [cell addSubview:WeChatBtn];
        
    }if (indexPath.row == 1) {
        cell.textLabel.text = @"可提现金额";
        cell.textLabel.font = [UIFont fontWithName:@"Heiti SC" size:16 *MYWIDTH];
    }if (indexPath.row == 2) {
        cell.textLabel.text = @"提现金额";
        cell.textLabel.font = [UIFont fontWithName:@"Heiti SC" size:16 *MYWIDTH];
    }
    return cell;
}
-(void)WeChatClick:(UIButton *)button{
    NSLog(@"绑定微信号");
    WeChatViewController *WeChatVC = [[WeChatViewController alloc]init];
    [self.navigationController pushViewController:WeChatVC animated:YES];
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [_tableView deselectRowAtIndexPath:indexPath animated:NO];
    if (indexPath.row == 0) {
        
    }if (indexPath.row == 1) {
        NSLog(@"可提现金额");
    }if (indexPath.row == 2) {
        NSLog(@"提现金额");
    }
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 80;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
